﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aulac.Global.Xml;
using Aulac.Rsc.Ems;
using System.Data;
using Aulac.Global.Common;
using Aulac.Global.Data;

namespace Aulac.Srv.Db.Data.Ems.Systems
{
    partial class CompanyMng
    {
        private string GeHspInsCodeDb()
        {
            string sqlQuery = string.Format("SELECT TOP {0}, {1} FROM {2}", tagSystem.Company.InsPrvcCode, tagSystem.Company.InsOffciceCode, TableNames.Sys_CompanyInfo);
            DataTable tb = DbDataProvider.ExecuteReaderDataToTable(mDbCmd, sqlQuery);
            if (ValueHelper.isEmpty(tb))
            {
                string sHspCode = DataTableProcess.GetValue(tb.Rows[0], tagSystem.Company.InsOffciceCode);
                string sInsPrvc = DataTableProcess.GetValue(tb.Rows[0], tagSystem.Company.InsPrvcCode);
                return string.Format("{0}-{1}", sInsPrvc, sHspCode);
            }
            return "";
            
        }
    }
}
